/* 全局响应式优化样式 */

/* 基础响应式断点 */
:root {
  --breakpoint-xs: 0;
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  --breakpoint-xxl: 1400px;
}

/* 全局容器响应式 */
.container-fluid {
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (max-width: 768px) {
  .container-fluid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (max-width: 576px) {
  .container-fluid {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }
}

/* 表格响应式增强 */
.table-responsive-enhanced {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.375rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.table-responsive-enhanced::-webkit-scrollbar {
  height: 8px;
}

.table-responsive-enhanced::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-responsive-enhanced::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-responsive-enhanced::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 固定列表格 */
.table-fixed-columns {
  min-width: 100%;
  table-layout: auto;
}

.table-fixed-columns th,
.table-fixed-columns td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 第一列固定 */
.table-fixed-columns th:first-child,
.table-fixed-columns td:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 10;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  min-width: 100px;
}

/* 最后一列固定（操作列） */
.table-fixed-columns th:last-child,
.table-fixed-columns td:last-child {
  position: sticky;
  right: 0;
  background: white;
  z-index: 10;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  min-width: 120px;
}

/* 模态框响应式优化 */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }
  
  .modal-xl {
    max-width: calc(100% - 1rem);
  }
  
  .modal-lg {
    max-width: calc(100% - 1rem);
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-header {
    padding: 0.75rem 1rem;
  }
  
  .modal-footer {
    padding: 0.75rem 1rem;
  }
}

@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.25rem;
    max-width: calc(100% - 0.5rem);
  }
  
  .modal-body {
    padding: 0.75rem;
  }
  
  .modal-header {
    padding: 0.5rem 0.75rem;
  }
  
  .modal-footer {
    padding: 0.5rem 0.75rem;
  }
  
  .modal-title {
    font-size: 1rem;
  }
}

/* 卡片响应式优化 */
@media (max-width: 768px) {
  .card {
    margin-bottom: 1rem;
  }
  
  .card-header {
    padding: 0.75rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .card {
    margin-bottom: 0.75rem;
  }
  
  .card-header {
    padding: 0.5rem;
  }
  
  .card-body {
    padding: 0.5rem;
  }
  
  .card-title {
    font-size: 1rem;
  }
}

/* 按钮组响应式 */
@media (max-width: 768px) {
  .btn-group {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .btn-group .btn {
    margin-bottom: 0.25rem;
  }
  
  .btn-group-sm .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 576px) {
  .btn-group-sm .btn {
    padding: 0.15rem 0.3rem;
    font-size: 0.7rem;
  }
}

/* 表单响应式优化 */
@media (max-width: 768px) {
  .form-label {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }
  
  .form-control,
  .form-select {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }
  
  .form-control-sm,
  .form-select-sm {
    font-size: 0.8rem;
    padding: 0.375rem 0.5rem;
  }
}

@media (max-width: 576px) {
  .form-label {
    font-size: 0.85rem;
  }
  
  .form-control,
  .form-select {
    font-size: 0.85rem;
    padding: 0.375rem 0.5rem;
  }
  
  .form-control-sm,
  .form-select-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
  }
}

/* 分页响应式优化 */
@media (max-width: 768px) {
  .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .pagination .page-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 576px) {
  .pagination .page-link {
    padding: 0.25rem 0.375rem;
    font-size: 0.75rem;
  }
  
  .pagination .page-item:not(.active):not(.disabled) {
    display: none;
  }
  
  .pagination .page-item.active,
  .pagination .page-item:first-child,
  .pagination .page-item:last-child,
  .pagination .page-item:nth-child(2),
  .pagination .page-item:nth-last-child(2) {
    display: block;
  }
}

/* 文本响应式 */
@media (max-width: 768px) {
  .display-1 { font-size: 3rem; }
  .display-2 { font-size: 2.5rem; }
  .display-3 { font-size: 2rem; }
  .display-4 { font-size: 1.75rem; }
  .display-5 { font-size: 1.5rem; }
  .display-6 { font-size: 1.25rem; }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.9rem; }
}

@media (max-width: 576px) {
  .display-1 { font-size: 2.5rem; }
  .display-2 { font-size: 2rem; }
  .display-3 { font-size: 1.75rem; }
  .display-4 { font-size: 1.5rem; }
  .display-5 { font-size: 1.25rem; }
  .display-6 { font-size: 1.1rem; }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
  h4 { font-size: 1rem; }
  h5 { font-size: 0.9rem; }
  h6 { font-size: 0.85rem; }
}

/* 间距响应式 */
@media (max-width: 768px) {
  .p-4 { padding: 1rem !important; }
  .p-5 { padding: 1.5rem !important; }
  .m-4 { margin: 1rem !important; }
  .m-5 { margin: 1.5rem !important; }
}

@media (max-width: 576px) {
  .p-3 { padding: 0.75rem !important; }
  .p-4 { padding: 0.75rem !important; }
  .p-5 { padding: 1rem !important; }
  .m-3 { margin: 0.75rem !important; }
  .m-4 { margin: 0.75rem !important; }
  .m-5 { margin: 1rem !important; }
}

/* 工具类 */
.text-truncate-mobile {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .d-md-none { display: none !important; }
  .d-md-block { display: block !important; }
  .d-md-flex { display: flex !important; }
}

@media (max-width: 576px) {
  .d-sm-none { display: none !important; }
  .d-sm-block { display: block !important; }
  .d-sm-flex { display: flex !important; }
}

/* 滚动条美化 */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #c1c1c1 #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 加载状态响应式 */
@media (max-width: 768px) {
  .spinner-border {
    width: 2rem;
    height: 2rem;
  }
  
  .spinner-border-sm {
    width: 1rem;
    height: 1rem;
  }
}

/* 徽章响应式 */
@media (max-width: 576px) {
  .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
  }
}

/* 导航响应式优化 */
@media (max-width: 768px) {
  .navbar-nav {
    flex-direction: column;
  }
  
  .navbar-nav .nav-link {
    padding: 0.5rem 1rem;
  }
}

/* 侧边栏响应式 */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100vh;
    transition: left 0.3s ease;
    z-index: 1050;
  }
  
  .sidebar.show {
    left: 0;
  }
  
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
}